package com.qf;

public class AsyncDemo {

    public static void main(String[] args) {

        // 创建三个任务对象
        MyTask task1 = new MyTask("task1", 3);
        MyTask task2 = new MyTask("task2", 2);
        MyTask task3 = new MyTask("task3", 4);

        // 创建三个线程对象
        Thread t1 = new Thread(task1,"t1");
        Thread t2 = new Thread(task2,"t2");
        Thread t3 = new Thread(task3,"t3");

        // 启动三个线程 （注意，启动线程的方法是start，而不是run）
        t1.start();
        t2.start();
        t3.start();

        System.out.println(Thread.currentThread().getName()+"完成了！");

    }

}
